

            <div class="list">
                <table>
                    <thead>
                        <tr>
                                                
                            <g:sortableColumn property="title" title="${message(code: 'post.title.label', default: 'Title')}" />

                            <th>${message(code: 'post.content.label', default: 'Content')}</th>
                             
                            <th>${message(code: 'post.createTime.label', default: 'Content')}</th>

                            <th>发布人</th>

                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${teacherPostList}" status="i" var="postInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                            <td>${fieldValue(bean: postInstance, field: "title")}</td>

                            <td>${fieldValue(bean: postInstance, field: "content")}</td>

                            <td><g:formatDate date="${postInstance?.createTime}" format="yyyy年MM月dd日 HH:mm:ss"/></td>

                            <td>${fieldValue(bean: postInstance, field: "teacher.realname")}</td>

                            <td>
                                     <g:link action="show" id="${postInstance.id}" controller="post">详情</g:link>

                                    <g:ifAnyGranted role="ROLE_ADMIN">
                                        <g:link action="edit" id="${postInstance.id}" controller="post">修改</g:link>
                                        <g:link action="delete" id="${postInstance.id}"  controller="post" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">删除</g:link>
                                     </g:ifAnyGranted>

                                     <g:if test="${postInstance.teacher.id.toString() == loggedInUserInfo(field:'id').toString()}">
                                        <g:link action="edit" id="${postInstance.id}" controller="post" params="[flag:'1']">修改</g:link>
                                        <g:link action="delete" id="${postInstance.id}"  controller="postMgr" params="[flag:'1']" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">删除</g:link>
                                     </g:if>
                                    
                            </td>
                        
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <x:paginate total="${teacherPostCount}" />
            </div>
